<?php
class Category {

    public function getByObj(Category $c) {
        $list = array();
        $sql = 'SELECT * FROM caws_category ';
        $result = mysql_query($sql);
        $i = 0;
        while($rows = mysql_fetch_array($result)) {
            $list[$i]['ID'] = $rows['ID'];
            $list[$i]['category_name'] = $rows['Category_Name'];
            $i++;
        }
        return $list;
    }

    public function getById($ID) {
        $list = array();
        $sql = "SELECT * FROM caws_category
               WHERE ID = '" . $ID . "' ";
        $result = mysql_query($sql);
        $i = 0;
        while($rows = mysql_fetch_array($result)) {
            $list[$i]['ID'] = $rows['ID'];
            $list[$i]['category_name'] = $rows['Category_Name'];
            $i++;
        }
        return $list;
    }
}
?>
